package com.xinchen.aiounlimit.vm

import com.maple.utils.util.HttpRequestUtils
import com.xinchen.aiounlimit.base.BaseViewModel
import com.xinchen.aiounlimit.model.repository.CommonRepository
import java.util.WeakHashMap

class AccountViewModel: BaseViewModel(){

    private val repository by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) { CommonRepository() }


    fun onLogin(user: WeakHashMap<String, Any>) {
        HttpRequestUtils.clearAccessToken()
        launchOnlyResult(block = {
            val params: WeakHashMap<String, Any> = WeakHashMap()
            params.put("user", user)
            repository.login(params)
        }, success = {

        })
    }
}